﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Reflection;
using albert.DB.Interface;

namespace MyReflection20180618
{
    public class SimpleFactory
    {
        private static int SqlType = 0;

        private static string TypeDll = ConfigurationManager.AppSettings["IDBHelper"];
        private static string TypeName = TypeDll.Split(',')[0];
        private static string DllName = TypeDll.Split(',')[1];

        public static IDBHelper CreateDBHleper()
        {
            Assembly assembly = Assembly.Load(DllName);
            Type typeHelper = assembly.GetType(TypeName);
            object oDBHelper = Activator.CreateInstance(typeHelper);
            IDBHelper dbHelper = (IDBHelper)oDBHelper;

            return dbHelper;
        }
    }
}
